export default {
    data() {
        return {
            tableData: [],
            count: 0,
            page: 1,
            limit: 10,
           list:[
           		{
           			number:1,
           			odd_number:1,
           			uid:1,
           			portrait:"",
           			auth:"已认证",
           			name:"姚新宇",
           			time:"2018.05.15 15:30",
           			state:"处理中",
           			updata_time:"2018.05.15  15:30",
           			personnel:"管理员",
           			operation:"跟进"
           		}
           ]
        }
    },
    //进入页面加载
    mounted: function() {
        var that = this;
        //在缓存中获取值
        that.user_name = sessionStorage.getItem("user_name");
        that.user_id = sessionStorage.getItem("user_id");
        that.token = sessionStorage.getItem("access-token");
        if ((!that.token) || (!that.user_id) || (!that.user_name)) {
            that.$router.push('/login');
        }
        //请求员工列表
        that.getList();
    },

    methods: {
        /**
		 * 意见列表
         */
        getList: function () {
            let that = this;
            //初始化数据
            that.tableData = [];
            that.count = 0;
            //请求登陆接口
            that.$http.post(that.adminApi.api_url + "/api/opinion/index", {
                token: that.token,
            }, {
                emulateJSON: true
            }).then(
                function (res) {
                    // 处理成功的结果
                    if (res.body.list) {
                        for (var i in res.body.list) {
                        	if(res.body.list[i].is_certification === 2){
                        		var is_certification = '未认证';
							}else{
                                var is_certification = '已认证';
							}
                            that.tableData.push({
                                number: Number(i)+1,
                                id: res.body.list[i].id,
                                // number: res.body.list[i].id,
                                odd_number: res.body.list[i].sn,
                                member_id: res.body.list[i].user_id,
                                uid: "<div style='color: #000fff'>" + res.body.list[i].user_no + "</div>",
                                portrait: res.body.list[i].avatar_url,
                                auth: is_certification,
                                name: res.body.list[i].real_name,
                                time: res.body.list[i].create_time,
                                state: res.body.list[i].proc_status,
                                updata_time: res.body.list[i].update_time,
                                personnel: res.body.list[i].system_manager_id,
                            });
                        }
                        that.count = res.body.count;
                    }
                },
                function () {
                    // 处理失败的结果
                    that.$message({
                        type: 'error',
                        message: `操作提示: ${ '处理异常' }`
                    });
                });
        },

        //下一页
        handleCurrentChange: function (currentPage) {
            let that = this;
            that.page = currentPage;
        },

        /**
		 * 跟进
         */
        toDetail:function (e) {
			var that=this;
			that.$router.push({path: '/user/feedback_detail',query: {feedback_id: e}});
        },

        /**
		 * 用户详情
         */
        toInfo:function (e) {
            let that = this;
            that.$router.push({
                path: '/user/information',
                query: {member_id: e}
            });
        }
    }
}